package ThreadDemo;



/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo03_获取线程引用 {
    public static void main(String[] args) {
        // 创建线程对象并指定线程的名称
        TaskThread t1 = new TaskThread("线程1");
        TaskThread t2 = new TaskThread("线程2");

        t1.start();
        t2.start();

        // 获取这两个对象的内存地址值
        String memoryAdd_t1 = Integer.toHexString(t1.hashCode());
        String memoryAdd_t2 = Integer.toHexString(t2.hashCode());

        // 获取t1对象的内存地址值
        System.out.println("main: 【" + t1.getName() + "】的内存地址值是: " + memoryAdd_t1);
        System.out.println("main: 【" + t2.getName() + "】的内存地址值是: " + memoryAdd_t2);
    }
}